package stars.starGroups;

import events.physicalModel.GetLuminosityEvent;
import events.physicalModel.GetMassEvent;
import events.physicalModel.GetOrbitalRadiusEvent;
import events.physicalModel.GetRadiusEvent;
import events.physicalModel.ReplyGetMassEvent;
import events.physicalModel.SetOrbitalRadiusEvent;
import gameAppLayer.enums.Constants;

import java.util.ArrayList;
import java.util.HashSet;

import com.jme3.math.Vector2f;

import controller.IController;

import stars.StarModel;
import utilities.Key;
import view.AbstractView;
import view.IView;
import view.View;

import model.IModel;
import model.IPhysicalDataModel;
import model.IPhysicalDataModelContainer;
import model.AbstractModel;
import model.PhysicalDataModelContainer;
import model.PhysicalDataModel;

/*
 * Any binary, trinary, or quad groupings of stars are held in an instantiation of this container class
 * 
 */
public class StarGroupModel implements IModel, IPhysicalDataModelContainer {// PhysicalDatasetContainer {
	
	//private ArrayList<Key> starList = new ArrayList<Key>();
	
	private Key homeStarSystemKey;
	private AbstractModel model;
	private PhysicalDataModelContainer physicalDatasetContainer;
	
	public StarGroupModel() {
		this.model = new AbstractModel();
		this.physicalDatasetContainer = new PhysicalDataModelContainer();
	}
	
	public StarGroupModel(Key homeStarSystemKey) {
		this.homeStarSystemKey = homeStarSystemKey;
		this.model = new AbstractModel();
		this.physicalDatasetContainer = new PhysicalDataModelContainer();
	}
	
	public void addStar(StarModel star) {
		physicalDatasetContainer.addPhysicalModel(star);		
	}
	
	public void removeStar(StarModel star) {
		physicalDatasetContainer.removePhysicalModel(star);		
	}
	
	public Key getHomeStarSystemKey() {
		return homeStarSystemKey;
	}

	public void setHomeStarSystemKey(Key homeStarSystemKey) {
		this.homeStarSystemKey = homeStarSystemKey;
	}
	
	
	//IModel methods
	public void attach(AbstractView view) {
		model.setSpatial(view);
	}

	public void detach(AbstractView view) {
		model.detach(view);
	}

	public void updateViews() {
		model.updateViews();
	}

	public void setController(IController controller) {
		model.setController(controller);
	}

	public IController getController() {
		return model.getController();
	}

	public Key getKey() {
		return model.getKey();
	}

	public void setKey(Key key) {
		model.setKey(key);
	}

	public int getKeyValue() {
		return model.getKeyValue();
	}
	
	//IPhysicalDatasetContainer
	public void addPhysicalModel(IPhysicalDataModel model) {
		physicalDatasetContainer.addPhysicalModel(model);
	}

	public void removePhysicalModel(IPhysicalDataModel model) {
		physicalDatasetContainer.removePhysicalModel(model);
	}

	public void updateParameters() {
		physicalDatasetContainer.updateParameters();
	}

	public Vector2f getLocation() {
		return physicalDatasetContainer.getLocation();
	}

	public Vector2f getVelocity() {
		return physicalDatasetContainer.getVelocity();
	}

	public double getTotalMass() {
		return physicalDatasetContainer.getTotalMass();
	}

	public double getTotalLuminosity() {
		return physicalDatasetContainer.getTotalLuminosity();
	}

	public double getOrbitalRadius() {
		return physicalDatasetContainer.getOrbitalRadius();
	}

	public double getTotalRadius() {
		return physicalDatasetContainer.getTotalRadius();
	}

	public double getTotalVolume() {
		return physicalDatasetContainer.getTotalVolume();
	}

	public double getAverageDensity() {
		return physicalDatasetContainer.getAverageDensity();
	}

	public double getTotalFullEnergy() {
		return physicalDatasetContainer.getTotalFullEnergy();
	}

	public double getTotalMassEnergy() {
		return physicalDatasetContainer.getTotalMassEnergy();
	}

	public double getTotalSpinEnergy() {
		return physicalDatasetContainer.getTotalSpinEnergy();
	}

	public double getTotalRadiationEnergy() {
		return physicalDatasetContainer.getTotalRadiationEnergy();
	}

	public double getTotalGravEnergy() {
		return physicalDatasetContainer.getTotalGravEnergy();
	}

	public double getTotalMagneticEnergy() {
		return physicalDatasetContainer.getTotalMagneticEnergy();
	}

	public double getAverageAge() {
		return physicalDatasetContainer.getAverageAge();
	}

	public double getTotalGravity() {
		return physicalDatasetContainer.getTotalGravity();
	}

	public double getAverageRotation() {
		return physicalDatasetContainer.getAverageRotation();
	}

	public double getAverageTemperature() {
		return physicalDatasetContainer.getAverageTemperature();
	}

	public double getTotalMagField() {
		return physicalDatasetContainer.getTotalMagField();
	}

	public String getCurrentName() {
		return physicalDatasetContainer.getCurrentName();
	}

	public ArrayList<Double> getMassList() {
		return physicalDatasetContainer.getMassList();
	}

	public ArrayList<Double> getVolumeList() {
		return physicalDatasetContainer.getVolumeList();
	}

	public ArrayList<Double> getDensityList() {
		return physicalDatasetContainer.getDensityList();
	}

	public ArrayList<Double> getFullEnergyList() {
		return physicalDatasetContainer.getFullEnergyList();
	}

	public ArrayList<Double> getMassEnergyList() {
		return physicalDatasetContainer.getMassEnergyList();
	}

	public ArrayList<Double> getSpinEnergyList() {
		return physicalDatasetContainer.getSpinEnergyList();
	}

	public ArrayList<Double> getRadiationEnergyList() {
		return physicalDatasetContainer.getRadiationEnergyList();
	}

	public ArrayList<Double> getGravEnergyList() {
		return physicalDatasetContainer.getGravEnergyList();
	}

	public ArrayList<Double> getMagneticEnergyList() {
		return physicalDatasetContainer.getMagneticEnergyList();
	}

	public ArrayList<Double> getAgeList() {
		return physicalDatasetContainer.getAgeList();
	}

	public ArrayList<Double> getGravityList() {
		return physicalDatasetContainer.getGravityList();
	}

	public ArrayList<Double> getRotationList() {
		return physicalDatasetContainer.getRotationList();
	}

	public ArrayList<Double> getTemperatureList() {
		return physicalDatasetContainer.getTemperatureList();
	}

	public ArrayList<Double> getRadiusList() {
		return physicalDatasetContainer.getRadiusList();
	}

	public ArrayList<Double> getOrbitalRadiusList() {
		return physicalDatasetContainer.getOrbitalRadiusList();
	}

	public ArrayList<Double> getLuminosityList() {
		return physicalDatasetContainer.getLuminosityList();
	}

	public ArrayList<Double> getMagFieldList() {
		return physicalDatasetContainer.getMagFieldList();
	}

	public ArrayList<String> getNameList() {
		return physicalDatasetContainer.getNameList();
	}

	public void addName(String name) {
		physicalDatasetContainer.addName(name);
	}

	public void removeName(String name) {
		physicalDatasetContainer.removeName(name);
	}

	
}
